﻿namespace IBTrader.Charts.Windows
{
    using System.Collections.Generic;
    using System.Drawing.Imaging;
    using System.IO;
    using System.Windows.Media.Imaging;

    class ImageSourceGraphics : ImageGraphics
    {
        internal readonly BitmapImage BitmapImage = new BitmapImage();

        public ImageSourceGraphics(IEnumerable<IChart> charts, double width, double height)
        {
            base.Draw(charts, width, height);
        }
        
        protected override void Save(System.Drawing.Bitmap bmp)
        {
            var ms = new MemoryStream();
            bmp.Save(ms, ImageFormat.Png);
            BitmapImage.BeginInit();
            BitmapImage.StreamSource = ms;
            BitmapImage.EndInit();
        }
    }
}
